package org.cmroot.certmaster.client.widgets;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

/**
 * Copyright (c) 2010 Andrey Domas <andrey.domas at gmail.com>.
 * *
 * This file is part of certmaster.
 * *
 * Certmaster is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * *
 * Certmaster is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see http://www.gnu.org/licenses
 * or write to the Free Software Foundation,Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301  USA
 */
public class ErrorLabel extends Composite {
    interface ErrorLabelUiBinder extends UiBinder<Widget, ErrorLabel> {
    }

    private static ErrorLabelUiBinder _errorLabelUiBinder = GWT.create(ErrorLabelUiBinder.class);

    @UiField
    Label error_label_widget;

    public ErrorLabel() {
        initWidget(_errorLabelUiBinder.createAndBindUi(this));
    }

    public void showError(String msg) {
        this.error_label_widget.setText(msg);
        this.error_label_widget.setVisible(true);
    }

    public void resetError() {
        this.error_label_widget.setVisible(false);
        this.error_label_widget.setText(null);
    }

}
